//
//  MCAfterSaleDetailWriteRefuseReasonView.swift
//  StoreManage
//
//  Created by MC on 2018/2/12.
//  Copyright © 2018年 MC. All rights reserved.
//

import UIKit

class MCAfterSaleDetailWriteRefuseReasonView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.init(white: 0, alpha: 0.4)

        let tap  = UITapGestureRecognizer.init(target: self, action: #selector(dismissSelf))
        self.addGestureRecognizer(tap)
        
        self.addSubview(whiteView)
        whiteView.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(40)
            make.right.equalTo(-40)
            make.top.equalTo(MCScreenHeight / 4.2)
            make.height.equalTo(240)
        }
        
        whiteView.addSubview(titleLabel)
        titleLabel.snp.remakeConstraints { (make) ->Void in
            make.centerX.equalTo(whiteView)
            make.top.equalTo(whiteView)
            make.height.equalTo(40)
        }
        
        
        whiteView.addSubview(cancelButton)
        cancelButton.snp.remakeConstraints { (make) ->Void in
            make.right.equalTo(-10)
            make.centerY.equalTo(titleLabel)
            make.size.equalTo(CGSize.init(width: 25, height: 25))
        }
        whiteView.addSubview(lineOneView)
        lineOneView.snp.remakeConstraints { (make) ->Void in
            make.left.right.equalTo(whiteView)
            make.top.equalTo(titleLabel.snp.bottom)
            make.height.equalTo(1)
        }
        
        whiteView.addSubview(lineTwoView)
        lineTwoView.snp.remakeConstraints { (make) ->Void in
            make.left.right.equalTo(whiteView)
            make.bottom.equalTo(whiteView).offset(-40)
            make.height.equalTo(1)
        }

        
        whiteView.addSubview(saveButton)
        saveButton.snp.remakeConstraints { (make) ->Void in
            make.left.right.bottom.equalTo(whiteView)
            make.height.equalTo(40)
        }
        
        whiteView.addSubview(textView)
        textView.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(15)
            make.right.equalTo(-15)
            make.top.equalTo(lineOneView).offset(15)
            make.bottom.equalTo(lineTwoView).offset(-15)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    @objc func dismissSelf() {
        self.removeFromSuperview()
    }

    lazy var whiteView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.white
        return view
    }()
    
    lazy var lineOneView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCGray_light
        return view
    }()

    
    lazy var lineTwoView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCGray_light
        return view
    }()

    lazy var textView: UITextView = {
        let view = UITextView()
        view.layer.cornerRadius = 5
        view.layer.masksToBounds = true
        view.backgroundColor = UIColor.MCGray_light
        view.font = MCFont(14)
        view.becomeFirstResponder()
        return view
    }()
    
    

    lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(15)
        label.textColor = UIColor.MCBlack
        label.text = "拒绝理由"
        return label
    }()
    
    lazy var saveButton: UIButton = {
        let button = UIButton.init(type: UIButtonType.custom)
        button.titleLabel?.font = MCFont(14)
        button.setTitle("保存", for: UIControlState.normal)
        button.setTitleColor(UIColor.MCMain, for: UIControlState.normal)
        return button
    }()
    
    lazy var cancelButton: UIButton = {
        let button = UIButton.init(type: UIButtonType.custom)
        button.setImage(#imageLiteral(resourceName: "GoodsManage_delete"), for: UIControlState.normal)
        button.addTarget(self, action: #selector(dismissSelf), for: UIControlEvents.touchUpInside)
        return button
    }()

}
